<template>
  <div>
    <h3>我的总资产：{{ moneyCount }}</h3>
    <h4>是不是有钱人<input type="checkbox" :checked="flag" /></h4>
    <h4>
      目前的状态：
      {{ moneyCount >= 10000 ? '有钱人' : '穷光蛋' }}
    </h4>
    <div>
      消费项目：
      <button @click="foot">洗脚60</button>
      <button @click="eat">吃饭100</button>
      <button @click="yue">约会1000</button>
      <button @click="song">送外卖+100</button>
    </div>
  </div>
</template>
<script>
export default {
  name: 'demo-zuoye',
  data() {
    return {
      moneyCount: 10000,
      flag: false,
    }
  },
  methods: {
    foot() {
      this.moneyCount -= 60
      if (this.moneyCount >= 10000) {
        this.flag = true
      } else {
        this.flag = false
      }
    },
    eat() {
      this.moneyCount -= 100
      if (this.moneyCount >= 10000) {
        this.flag = true
      } else {
        this.flag = false
      }
    },
    yue() {
      this.moneyCount -= 1000
      if (this.moneyCount >= 10000) {
        this.flag = true
      } else {
        this.flag = false
      }
    },
    song() {
      this.moneyCount += 100
      if (this.moneyCount >= 10000) {
        this.flag = true
      } else {
        this.flag = false
      }
    },
  },
}
</script>
